package com.sj.purchase.modules.cost.domain.price;
import com.sj.purchase.modules.cost.domain.order.Order;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.data.jpa.domain.AbstractPersistable;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import java.util.Date;

/**
 * 移动成本价
 * Created by yangrd on 2017/10/26
 **/
@Entity
@Table(name = "t_cost_price")
public class CostPrice extends AbstractPersistable<Long> {
    private String orderNo;

    private Order.OrderType orderType;

    @Excel(name = "sku", width = 35)
    private String skuNo;//sku编码

    @Temporal(TemporalType.TIMESTAMP)
    private Date createDate;//创建时间

    private Double lastAvgCostPrice;//计算移动平均价之前的平均价

    private Long lastInventoryQty;//计算移动平均价之前的库存

    private Double avgCostPrice;//计算移动平均价之后的平均成本价

    private Long inventoryQty;//计算移动平均价之后的數量


    public CostPrice() {
    }

    public CostPrice(String orderNo, Order.OrderType orderType, String skuNo, Date createDate, Double lastAvgCostPrice, Long lastInventoryQty, Double avgCostPrice, Long inventoryQty) {
        this.orderNo = orderNo;
        this.orderType = orderType;
        this.skuNo = skuNo;
        this.createDate = createDate;
        this.lastAvgCostPrice = lastAvgCostPrice;
        this.lastInventoryQty = lastInventoryQty;
        this.avgCostPrice = avgCostPrice;
        this.inventoryQty = inventoryQty;
    }

    public CostPrice(String skuNo, Date createDate, Double avgCostPrice, Long inventoryQty) {
        this.skuNo = skuNo;
        this.createDate = createDate;
        this.avgCostPrice = avgCostPrice;
        this.inventoryQty = inventoryQty;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public CostPrice setOrderNo(String orderNo) {
        this.orderNo = orderNo;
        return this;
    }

    public Order.OrderType getOrderType() {
        return orderType;
    }

    public CostPrice setOrderType(Order.OrderType orderType) {
        this.orderType = orderType;
        return this;
    }

    public String getSkuNo() {
        return skuNo;
    }

    public CostPrice setSkuNo(String skuNo) {
        this.skuNo = skuNo;
        return this;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public CostPrice setCreateDate(Date createDate) {
        this.createDate = createDate;
        return this;
    }

    public Double getLastAvgCostPrice() {
        return lastAvgCostPrice;
    }

    public CostPrice setLastAvgCostPrice(Double lastAvgCostPrice) {
        this.lastAvgCostPrice = lastAvgCostPrice;
        return this;
    }

    public Long getLastInventoryQty() {
        return lastInventoryQty;
    }

    public CostPrice setLastInventoryQty(Long lastInventoryQty) {
        this.lastInventoryQty = lastInventoryQty;
        return this;
    }

    public Double getAvgCostPrice() {
        return avgCostPrice;
    }

    public CostPrice setAvgCostPrice(Double avgCostPrice) {
        this.avgCostPrice = avgCostPrice;
        return this;
    }

    public Long getInventoryQty() {
        return inventoryQty;
    }

    public CostPrice setInventoryQty(Long inventoryQty) {
        this.inventoryQty = inventoryQty;
        return this;
    }
}
